﻿<%@ WebHandler Language="C#" Class="ZSWeekPlanLookBoard" %>

using System;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.Web.SessionState;
using System.IO;
using ReportBusiness;
public class ZSWeekPlanLookBoard : IHttpHandler
{
    public bool IsReusable { get { return false; } }
    private uMESReportOracleDAL dal = new uMESReportOracleDAL();
    private ZSWeekPlanLookBoardBusiness pb = new ZSWeekPlanLookBoardBusiness();
    public void ProcessRequest(HttpContext context)
    {
        if (context.Request.QueryString["type"] != null && context.Request.QueryString["type"] == "GetPichan")
        {
            Dictionary<string, string> para = new Dictionary<string, string>();
            if (context.Request.Form["week"] != null)
            {
                para["week"] = context.Request.Form["week"].ToString();
            }

            DataTable dt = pb.GetMachineWeekPlan(para);

            var json = JsonConvert.SerializeObject(dt);
            context.Response.ContentType = "text/json";
            context.Response.Write(json.ToString());
            context.Response.End();
        }
        if (context.Request.QueryString["type"] != null && context.Request.QueryString["type"] == "GetDetails")
        {
            Dictionary<string, object> para = new Dictionary<string, object>();
            para["engineno"] = context.Request.Form["engineno"].ToString();
            para["workflowstepname"] = context.Request.Form["workflowstepname"].ToString();
            DataTable dt = pb.GetMachineWeekPlanDetails(para);
            var json = JsonConvert.SerializeObject(dt);

            json = "{\"data\":" + json.ToString()
                    + ",\"code\":" + "0"
                    + ",\"msg\":" + "0"
                    + "}";

            context.Response.ContentType = "text/json";
            context.Response.Write(json.ToString());
            context.Response.End();
        }
    }
}